#pragma once
#include "zf_common_headfile.h"
#include "Element.h"
#ifndef SYSTEM_H_
#define SYSTEM_H_

typedef enum
{
    ELEMENMT_NONE,//0
    CORNER_IN, //1
    RIGHT_CROSS_IN,//If you enter the cross, you will not judge the other elements
    LEFT_CROSS_IN,
    CROSS_IN,
    LEFT_CIRCLE_IN,//Judgment of local range ring, stronger anti-interference
    RIGHT_CIRCLE_IN,
    CIRCLE_PREV_D_M, // 6 //There are up and down inflection points before entering the ring
    CIRCLE_PREV_M,//There is only a mid-inflection point before entering the ring
    CIRCLE_PREV_ARC, //IN ARC 圆弧路段
    CIRCLE_WILL_IN,//Before entering the ring, you are about to enter the ring
    CIRCLE_HAVE_IN,//In the ring
    CIRCLE_OUT_D,//Out of the ring there is only an lower inflection point
    CIRCLE_TURN_D,
    CIRCLE_OUT_U,//Out of the ring there is only an upper inflection point

    GARAGE_FIND, //find garage
}Element_TendTypedef;



//元素变量
typedef struct
{
unsigned char left_cross_down;
unsigned char right_cross_down;

     // uint8_t Round_Prev_L;//Before entering the ring, the inflection point
     // uint8_t Round_Prev_M;//Before entering the ring, the middle inflection point
     // uint8_t Round_Prev_M_Flag;//if D_M status find M corner then this flag to be 1
     
     // uint8_t Round_Prev_U;//Before entering the ring, the upper inflection point
     // uint8_t Round_Prev_U_Boundary; //It is about to enter the ring, and in this line of the border, the different path is used
     // uint8_t will_flag;
     
     // uint8_t Round_Out_D;//Out of the ring down the inflection point
     // uint8_t Round_Out_D_Flag;//Out of the ring case
     // uint8_t Round_Out_D_Boundary;
     // uint8_t Round_Out_U;//Out of the ring on the inflection point
     // uint8_t Round_Out_U_Flag;
}Element_DataTypedef;

extern Element_DataTypedef Element0_DataStruct;//Left Element
extern Element_DataTypedef Element1_DataStruct;//Right Element
typedef struct 
{
     int stop_flag;
     uint8_t test_x;
     uint8_t test_y;
     Element_TendTypedef Element_Flag;//Element Flag Bit, Target: If the current bit ring is determined, the cross judgment is not performed
     Element_TendTypedef CIRCLE_Flag;//Ring status flags
}System_DataTypedef;
extern System_DataTypedef System_DataStruct;

#endif
/*关于本代码,讲解将会放在B站 UID:291400730*/